from django import forms

class UserLRForm(forms.Form):
    username=forms.CharField(
        label='用户名',
        min_length=2,
        max_length=10,
        error_messages={
            'min_length':'用户名长度小于2',
            'max_length':'用户名长度大于10'
        }
    )
    password=forms.CharField(
        label='密码',
        min_length=2,
        max_length=20,
        error_messages={
            'min_length': '用户名长度小于2',
            'max_length': '用户名长度大于20'
        },
        #CharField默认为文本框
        #设置输入框为密码框
        widget=forms.PasswordInput
    )